package top.hcode.hoj.dao.collect;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.hcode.hoj.mapper.CollHonorRecordMapper;
import top.hcode.hoj.pojo.entity.coll.CollHonorRecord;

import java.util.List;

/**
 * @author orangej
 * @since 2025-01-21
 */
@Service
public class CollHonorRecordDao extends ServiceImpl<CollHonorRecordMapper, CollHonorRecord> {
    public List<CollHonorRecord> getHonorRecordList(String uid, String collId) {
        return lambdaQuery().eq(CollHonorRecord::getUserId, uid)
                .eq(CollHonorRecord::getCollId, collId)
                .orderByDesc(CollHonorRecord::getHonorDate)
                .list();
    }

    public Integer countHonorRecord(String uid, String collId) {
        return lambdaQuery().eq(CollHonorRecord::getUserId, uid)
                .eq(CollHonorRecord::getCollId, collId)
                .count();
    }
}
